sgdk
|
Go to the source code of this file.
Classes | |
struct | VDPSprite |
struct | FrameSprite |
struct | AnimationFrame |
struct | Animation |
struct | SpriteDefinition |
struct | Sprite |
Defines | |
#define | SPRITE_CACHE_SIZE 128 |
#define | COLLISION_TYPE_NONE 0 |
#define | COLLISION_TYPE_BOX 1 |
#define | COLLISION_TYPE_CIRCLE 2 |
Functions | |
void | SPR_init (u16 cacheSize) |
Init the Sprite engine. | |
void | SPR_end () |
End the Sprite engine. | |
u16 | SPR_isInitialized () |
FALSE if sprite cache engine is not initialized. | |
void | SPR_initSprite (Sprite *sprite, SpriteDefinition *spriteDef, s16 x, s16 y, u16 attribut) |
Initialize the specified Sprite. By default a sprite use automatic VRAM tile allocation but you can fix it by using the SPR_setVRAMTileIndex(..) method. | |
void | SPR_setPosition (Sprite *sprite, s16 x, s16 y) |
Set sprite position. | |
void | SPR_setAttribut (Sprite *sprite, u16 attribut) |
Set sprite attribut. | |
void | SPR_setAnimAndFrame (Sprite *sprite, s16 anim, s16 frame) |
Set current sprite animation and frame. | |
void | SPR_setAnim (Sprite *sprite, s16 anim) |
Set current sprite animation. | |
void | SPR_setFrame (Sprite *sprite, s16 frame) |
Set current sprite frame. | |
void | SPR_nextFrame (Sprite *sprite) |
Pass to the next sprite frame. | |
void | SPR_setVRAMTileIndex (Sprite *sprite, s16 index) |
Set the VRAM tile position for this sprite. | |
void | SPR_setAlwaysVisible (Sprite *sprite, u16 value) |
Set the always visible flag this sprite. By setting it to TRUE the sprite is considered as always visible and won't require any visibility computation. | |
void | SPR_setNeverVisible (Sprite *sprite, u16 value) |
Set the never visible flag this sprite. By setting it to TRUE the sprite is considered as always hidden and won't be displayed. | |
void | SPR_clear () |
Test if specified sprites are in collision. | |
void | SPR_update (Sprite *sprites, u16 num) |
Update and display the specified list of sprite. This actually prepare the list cache and send it to the hardware (VDP) at Vint. |
Sprite engine.
Sprite engine providing advanced sprites manipulation and operations.
This unit use both the tile cache engine (see tilecache.h file for more info)
and the Sega Genesis VDP sprite capabilities (see vdp_spr.h file for more info).
#define COLLISION_TYPE_BOX 1 |
Bouding box collision tpye
#define COLLISION_TYPE_CIRCLE 2 |
Round circle collision tpye
#define COLLISION_TYPE_NONE 0 |
No collision tpye
#define SPRITE_CACHE_SIZE 128 |
Maximum number of sprite in the cache
void SPR_clear | ( | ) |
Test if specified sprites are in collision.
sprite1 | first sprite. |
sprite2 | second sprite. |
Clear all displayed sprites.
This actually clear the list cache and send it to the hardware (VDP) at Vint.
void SPR_end | ( | ) |
void SPR_init | ( | u16 | cacheSize | ) |
Init the Sprite engine.
cacheSize | size of the tile cache (in tile) for the automatic tile allocation. If set to 0 the default size is used (384 tiles) |
Initialize the sprite engine.
This actually allocate memory for sprite cache and initialize the tile cache engine if this is not alreay done.
void SPR_initSprite | ( | Sprite * | sprite, |
SpriteDefinition * | spriteDef, | ||
s16 | x, | ||
s16 | y, | ||
u16 | attribut | ||
) |
Initialize the specified Sprite.
By default a sprite use automatic VRAM tile allocation but you can fix it by using the SPR_setVRAMTileIndex(..) method.
sprite | Sprite to initialize. |
spriteDef | the SpriteDefinition data to assign to this sprite. |
x | default X position. |
y | default Y position. |
attribut | sprite attribut (see TILE_ATTR() macro). |
void SPR_nextFrame | ( | Sprite * | sprite | ) |
Pass to the next sprite frame.
sprite | Sprite to pass to next frame for |
void SPR_setAlwaysVisible | ( | Sprite * | sprite, |
u16 | value | ||
) |
Set the always visible flag this sprite.
By setting it to TRUE the sprite is considered as always visible
and won't require any visibility computation.
sprite | Sprite to set the always visible flag |
value | The always visible flag value (TRUE or FALSE) |
void SPR_setAnim | ( | Sprite * | sprite, |
s16 | anim | ||
) |
Set current sprite animation.
sprite | Sprite to set animation for |
anim | animation index to set. |
void SPR_setAnimAndFrame | ( | Sprite * | sprite, |
s16 | anim, | ||
s16 | frame | ||
) |
Set current sprite animation and frame.
sprite | Sprite to set animation and frame for |
anim | animation index to set |
frame | frame index to set |
void SPR_setAttribut | ( | Sprite * | sprite, |
u16 | attribut | ||
) |
Set sprite attribut.
sprite | Sprite to set attribut for |
attribut | attribut (see TILE_ATTRIBUT() macro) |
void SPR_setFrame | ( | Sprite * | sprite, |
s16 | frame | ||
) |
Set current sprite frame.
sprite | Sprite to set frame for |
frame | frame index to set. |
void SPR_setNeverVisible | ( | Sprite * | sprite, |
u16 | value | ||
) |
Set the never visible flag this sprite.
By setting it to TRUE the sprite is considered as always hidden
and won't be displayed.
sprite | Sprite to set the never visible flag |
value | The never visible flag value (TRUE or FALSE) |
void SPR_setPosition | ( | Sprite * | sprite, |
s16 | x, | ||
s16 | y | ||
) |
Set sprite position.
sprite | Sprite to set position for |
x | X position |
y | Y position |
void SPR_setVRAMTileIndex | ( | Sprite * | sprite, |
s16 | index | ||
) |
Set the VRAM tile position for this sprite.
sprite | Sprite to set the VRAM tile position for |
index | the tile position in VRAM where we will upload the sprite tiles. Set to -1 for automatic allocation (default). |
void SPR_update | ( | Sprite * | sprites, |
u16 | num | ||
) |
Update and display the specified list of sprite.
This actually prepare the list cache and send it to the hardware (VDP) at Vint.
sprites | sprites we want to prepare and display. |
num | number of sprites in the list. |